<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册页面</title>
    <link rel="stylesheet" href="enter/register.css">

</head>

<body>
    <div class="register">
        <div class="image"><img src="images/register.jpg" alt=""></div>
        <div class="informations">
            <div class="information">
                <form action="" name="registerForm">
                    <ul id="massage">
                        <li><input type="text" id="email" value="邮箱" name="email"></li>
                        <li><input type="text" id="check" value="验证码" name="check"></li>
                        <li><input type="text" id="firstName"  value="10-16位密码" name="firstName"></li>
                        <li><input type="text" id="checkName" value="10-16位密码" name="checkName"></li>
                    </ul>
                    <button class="request" style="font-size:16px;" type="button">发送验证码</button>
                </form>
                <div class="refer" style="cursor: pointer;">
                    <button style="color:white;" class="sign" type="button">注册</button>
                </div>
                <p>已有账号，直接<a href='enter.html' class='login'>登录</a></p>
            </div>

        </div>

    </div>
    </div>
    <script src="enter/register.js"></script>
    <script src="jQuery/jquery-3.6.0.js"></script>

<script>
    $('.request').click(function(){
        var username = $("#email").val()
        $.ajax({
            type:"post",
            url:"/user/verify",
            dataType:'json',
            data:"username="+username ,
            success :function(result){
                    alert(result.msg)
            }
        })
    })

    $('.sign').click(function(){
        var username = $("#email").val();
        var inputCode = $("#check").val();
        var password = $("#firstName").val();
        $.ajax({
            type:"post",
            url:"/user/register",
            dataType:'json',
            data:{username : username, inputCode : inputCode , password : password },
            success :function(result){
                alert(result.msg)
            }
        })
    })
</script>

</body>

</html>